\(\int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx\) [111]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 22, antiderivative size = 47 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\frac {2 \sin (c+d x)}{3 a d}+\frac {i \cos (c+d x)}{3 d (a+i a \tan (c+d x))} \]

[Out]

2/3*sin(d*x+c)/a/d+1/3*I*cos(d*x+c)/d/(a+I*a*tan(d*x+c))

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.091, Rules used = {3583, 2717} \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\frac {2 \sin (c+d x)}{3 a d}+\frac {i \cos (c+d x)}{3 d (a+i a \tan (c+d x))} \]

[In]

Int[Cos[c + d*x]/(a + I*a*Tan[c + d*x]),x]

[Out]

(2*Sin[c + d*x])/(3*a*d) + ((I/3)*Cos[c + d*x])/(d*(a + I*a*Tan[c + d*x]))

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3583

Int[((d_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[a*(d*
Sec[e + f*x])^m*((a + b*Tan[e + f*x])^n/(b*f*(m + 2*n))), x] + Dist[Simplify[m + n]/(a*(m + 2*n)), Int[(d*Sec[
e + f*x])^m*(a + b*Tan[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, m}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0] && NeQ[m + 2*n, 0] && IntegersQ[2*m, 2*n]

Rubi steps \begin{align*} \text {integral}& = \frac {i \cos (c+d x)}{3 d (a+i a \tan (c+d x))}+\frac {2 \int \cos (c+d x) \, dx}{3 a} \\ & = \frac {2 \sin (c+d x)}{3 a d}+\frac {i \cos (c+d x)}{3 d (a+i a \tan (c+d x))} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.31 (sec) , antiderivative size = 50, normalized size of antiderivative = 1.06 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=-\frac {\sec (c+d x) (-3+\cos (2 (c+d x))+2 i \sin (2 (c+d x)))}{6 a d (-i+\tan (c+d x))} \]

[In]

Integrate[Cos[c + d*x]/(a + I*a*Tan[c + d*x]),x]

[Out]

-1/6*(Sec[c + d*x]*(-3 + Cos[2*(c + d*x)] + (2*I)*Sin[2*(c + d*x)]))/(a*d*(-I + Tan[c + d*x]))

Maple [A] (verified)

Time = 0.75 (sec) , antiderivative size = 49, normalized size of antiderivative = 1.04

method result size
risch \(\frac {i {\mathrm e}^{-3 i \left (d x +c \right )}}{12 a d}+\frac {i \cos \left (d x +c \right )}{4 a d}+\frac {3 \sin \left (d x +c \right )}{4 a d}\) \(49\)
derivativedivides \(\frac {-\frac {2}{3 \left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {i}{\left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {3}{2 \left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {2}{4 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+4 i}}{a d}\) \(75\)
default \(\frac {-\frac {2}{3 \left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}+\frac {i}{\left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {3}{2 \left (-i+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}+\frac {2}{4 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )+4 i}}{a d}\) \(75\)
norman \(\frac {\frac {2 \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{3 a d}+\frac {2 \tan \left (d x +c \right )}{3 a d}-\frac {2 i \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{3 a d}-\frac {2 i \left (\tan ^{2}\left (d x +c \right )\right )}{3 a d}+\frac {4 \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{3 a d}-\frac {2 \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \tan \left (d x +c \right )}{3 a d}+\frac {2 i \tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \tan \left (d x +c \right )}{3 a d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \left (1+\tan ^{2}\left (d x +c \right )\right )}\) \(172\)

[In]

int(cos(d*x+c)/(a+I*a*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/12*I/a/d*exp(-3*I*(d*x+c))+1/4*I/a/d*cos(d*x+c)+3/4*sin(d*x+c)/a/d

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 41, normalized size of antiderivative = 0.87 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\frac {{\left (-3 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + 6 i \, e^{\left (2 i \, d x + 2 i \, c\right )} + i\right )} e^{\left (-3 i \, d x - 3 i \, c\right )}}{12 \, a d} \]

[In]

integrate(cos(d*x+c)/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/12*(-3*I*e^(4*I*d*x + 4*I*c) + 6*I*e^(2*I*d*x + 2*I*c) + I)*e^(-3*I*d*x - 3*I*c)/(a*d)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 126 vs. \(2 (36) = 72\).

Time = 0.17 (sec) , antiderivative size = 126, normalized size of antiderivative = 2.68 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\begin {cases} \frac {\left (- 24 i a^{2} d^{2} e^{5 i c} e^{i d x} + 48 i a^{2} d^{2} e^{3 i c} e^{- i d x} + 8 i a^{2} d^{2} e^{i c} e^{- 3 i d x}\right ) e^{- 4 i c}}{96 a^{3} d^{3}} & \text {for}\: a^{3} d^{3} e^{4 i c} \neq 0 \\\frac {x \left (e^{4 i c} + 2 e^{2 i c} + 1\right ) e^{- 3 i c}}{4 a} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)/(a+I*a*tan(d*x+c)),x)

[Out]

Piecewise(((-24*I*a**2*d**2*exp(5*I*c)*exp(I*d*x) + 48*I*a**2*d**2*exp(3*I*c)*exp(-I*d*x) + 8*I*a**2*d**2*exp(
I*c)*exp(-3*I*d*x))*exp(-4*I*c)/(96*a**3*d**3), Ne(a**3*d**3*exp(4*I*c), 0)), (x*(exp(4*I*c) + 2*exp(2*I*c) +
1)*exp(-3*I*c)/(4*a), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate(cos(d*x+c)/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [A] (verification not implemented)

none

Time = 0.41 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.43 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\frac {\frac {3}{a {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right )}} + \frac {9 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 12 i \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 7}{a {\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - i\right )}^{3}}}{6 \, d} \]

[In]

integrate(cos(d*x+c)/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

1/6*(3/(a*(tan(1/2*d*x + 1/2*c) + I)) + (9*tan(1/2*d*x + 1/2*c)^2 - 12*I*tan(1/2*d*x + 1/2*c) - 7)/(a*(tan(1/2
*d*x + 1/2*c) - I)^3))/d

Mupad [B] (verification not implemented)

Time = 3.97 (sec) , antiderivative size = 78, normalized size of antiderivative = 1.66 \[ \int \frac {\cos (c+d x)}{a+i a \tan (c+d x)} \, dx=\frac {\left (-3\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,3{}\mathrm {i}+\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1{}\mathrm {i}\right )\,2{}\mathrm {i}}{3\,a\,d\,\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )+1{}\mathrm {i}\right )\,{\left (1+\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,1{}\mathrm {i}\right )}^3} \]

[In]

int(cos(c + d*x)/(a + a*tan(c + d*x)*1i),x)

[Out]

((tan(c/2 + (d*x)/2) + tan(c/2 + (d*x)/2)^2*3i - 3*tan(c/2 + (d*x)/2)^3 + 1i)*2i)/(3*a*d*(tan(c/2 + (d*x)/2) +
 1i)*(tan(c/2 + (d*x)/2)*1i + 1)^3)